package utils

import (
	"fmt"
	"os"

	alipay "github.com/smartwalle/alipay/v3"
)

var (
	appID = "2016093000632803"

	privateKey   = "MIIEowIBAAKCAQEAvbyDu9bu4/S4kFrV8M4Qnk/QbePLEi1ri1AI37eZinPLTdbCVoWNDNBKy0KeScwFP0Pw/yLByQEN9mRIbxd2J+/zgKvCabbh3kYxzjmtt752bSYKCUSKuPWnyK+TOT8cHlSTMtP0o7xiVE+dmRngc8qhnCNm84Rb3gMhGwdnrObXyM+32uG+vXE9cmCSGnnZE9KFEVlcCklXV5Mf5Wo+p/frKkuJUOMipHDI4jWs08V69MxWWmMft09jf5oGdH5yaiVddfS7uTbaKqFBHjbhwWj01hqv2MC0YJyTnjGbVkphA5e7YdCexm2J+w27YndS6H1iEh82X8iOKisKTdpR7QIDAQABAoIBAEfrj1vCaydJejRt2i6/TZlU08Lz1+P6B4v1OIfkxnSu09+bimrVkNPMmK1XgTyj81E55b4wZJhWp/4/oR1LHWSiFgEuGjGMOy3QGcz8HBdMQQO6qY89xf+6TnFJ7FqEy5nLoUhhA5iVLgibbTe9kVES/BN9b+bawx/yu7fNJMVqy+3YxzvsOZ+4N1ZItwPLHsXGQRLi+XyHcigLBxcD2RZI6JvUatq2TEJQ8ocG6fr40SOzznKwabxnThA3VGp+PDOvyhP7sD4SmXh8hRXtB6VdM0W4cNkSUi3c9IqzMZCo309hoy+zd8xedsz5nApM1KFc8DZHAGHsws9nyJDrUAECgYEA6yGYn/q2JXuVo4wjm2+gOtuhykH8Rq1Gr6MYDUZ4csZ7TE1LDL099XaRxZ7nRPylO1uNSq8LriFve6cyTn9BHAZ0AZBBr+JOsOaSurtlwmNry9MNBQh3w9+0YZLnoFYoQ5dp1yUYYTylKKRSRwt/A9UacxaiftXp0afrJt/z5gECgYEAzpOBJ8eRNj8D52jNt3NTHBO9p2ds8xKuIBhDbxlBuNCgreay4cg1yeSr89N7FApLA3kgMMM9mBO1y0jR2tpba9hzM2vKyXTQYbTGOoPam498bAbpFANtcq0QJ5PgOfyqjh3pkA0VKBWpbqNgp+MMhJk74afWl2sRCdY1qn8cY+0CgYAN/C+RxF21GQardZhglGEZXxreZtJUedXseGzjzT84xGls/mPqXA8lXGoLMQpcZhKF10ouGP8+2ipBVo59cMA0pIWd2jCt/23iw7QSezbwOu2cb+8kT36gHdwiuZQhSz6V1pmq/D/Y+LxyEGP8aciiN7idA8midaK0n6Iy67scAQKBgQDAkLgBAQPYcX2OJiA+Nn7u2WgduUfSf0NaH8QcuIqPYcum0DtIRX3+qe+w5x8AW2f54NulGRs9vIHm8gbN4GcAbVFWSdFLYl0t93oh6e/Ku0Lc4MQ9J8TK9ZDtk+edpm7G9BNZeRiTuT2sKRhc6EYvBTjQ7cgYdnH3nXuBZ+RrMQKBgEOsB5ClsKsWpohhkZG45xwnMFf7jVkhBKDzrRbx55F5IJQRkSAdNrjT/s3fDCP51KaPwZnrIwGA+XkY1yIMN9eFtm4T4xOZHn2sLI10FrLHXfHSZhnHpZBaxilqoPGIIvK0KYIvbHwCfCno0OtL1ggCUKiZhoQ49O4JCq/P2hhj"
	aliPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjAfUxkKrfDbE+qi0YyTgASVLbIYlzNtg+WFo2hFJ8jYPb8r8+TdaGIbNTSpg/8pefu2SXUklW6sqsz1cbbGCjut+KOqEvjqnhyrOH9yuAKEXUEQjsCiz5LmTg9/vHftHMGvDUo3xWg8W+CwrQLqVaFj3wn06d2Jq25OnbDe9NheyXtUfNQDMbvl05dTvjjv29rFFqtHsqZraIPooGjNHM10eABiCU5yYoVm0L4qDOVg+bbp6lLYX2rWgAAmQU4rZ6+VeqMCGRArPQL9uuTcliZ+xTLk7zJXuMjQVg9g9kXytqtWjsSJQe3vkKZhqe3VeBKSp4zcB0A1lEF8MLpglGwIDAQAB"
)

var Client *alipay.Client

func Init() {
	var err error
	Client, err = alipay.New(appID, privateKey, false)

	if err != nil {
		fmt.Println("初始化支付宝失败, 错误信息为", err)
		os.Exit(-1)
	}
	Client.LoadAliPayPublicKey(aliPublicKey)
}
